#pragma once

#include <sys_reg.h>

typedef enum {
	BTIMER_MTIME_LO_R = 0x0,
	BTIMER_MTIME_HI_R = 0x4,
	BTIMER_MTIMECMP_LO_R = 0x8,
	BTIMER_MTIMECMP_HI_R = 0xC,
	BTIMER_MSTOP_R = 0xFF8,
	BTIMER_MSIP_R = 0xFFC,
} btimer_re;

static inline u32_s btimer_get_reg_q_by_q(u32_s btimer_q, btimer_re btimer_r) {
	return btimer_q + btimer_r;
}

static inline void btimer_wreg_by_q(u32_s btimer_q, btimer_re btimer_r,
				    u32_s value) {
	u32_s reg_q = btimer_get_reg_q_by_q(btimer_q, btimer_r);
	wreg(reg_q, value);
}

static inline u32_s btimer_rreg_by_q(u32_s btimer_q, btimer_re btimer_r) {
	u32_s reg_q = btimer_get_reg_q_by_q(btimer_q, btimer_r);
	return rreg(reg_q);
}
